package com.cserver.pro.service.impl;


import com.cserver.pro.entity.Coursetab;
import com.cserver.pro.entity.Student;
import com.cserver.pro.service.CoursetabService;
import com.cserver.pro.service.StudentService;
import com.cserver.pro.service.StudentServiceFade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class StudentServiceFadeImple  implements StudentServiceFade {

    @Autowired
    private StudentService studentService;

    @Autowired
    private CoursetabService coursetabService;


    @Override
    @Transactional
    public Student insert(Student student) {

        Coursetab coursetab=new Coursetab();
        coursetab.setCourseName("英语");
        Student student1 = studentService.queryById(1);

//       默认
        studentService.insert(student);
        //new
        coursetabService.insert(coursetab);
        //  }catch (Exception e){
        //     System.out.println("错误信息:"+e.getMessage());
        // }
        //student1.setName("张留");
        //默认
        try{
            studentService.update(student1);

        }catch (Exception e){

        }
        return student;
    }
}
